﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using System.Xml;
using System.Data.SqlClient;
using System.Data.Sql;
using MySql.Data;
using MySql.Data.MySqlClient;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;


namespace MysqlTest
{
        public class OrderDetail
        {
            [Key]
            public int OrderdetailID { get; set; }
            public string ProductName { get; set; }
            public int ProductNumber { get; set; }
            public int Value { get; set; }
            [ForeignKey("Order")]
            public int OrderID { get; set; }
            public Order order { get; set; }

            public OrderDetail(int orderdetailID, string productID, int productNumber, int value,int orderID)
            {
                this.OrderdetailID = orderdetailID;
                this.ProductName = productID;
                this.ProductNumber = productNumber;
                this.Value = value;
                this.OrderID = orderID;
            }
            public OrderDetail() { }


            public override string ToString()
            {
                return "ID：" + OrderdetailID + " 产品：" + ProductName + " 产品数：" + ProductNumber + " 单价：" + Value;
            }
            public override bool Equals(object obj)
            {
                OrderDetail m = obj as OrderDetail;
                return m.OrderdetailID == this.OrderdetailID && m != null;
            }
            public override int GetHashCode()
            {
                return base.GetHashCode();
            }
        }
    
}
